﻿
<?php 
@session_start();
if (!isset($_SESSION["taikhoan"]))
	{
		header("Location: cnk-dangnhap.php");
	}
include 'connect.php'; 
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>So Sánh Kết Quả Học Phần</title>
<style type="text/css">
<!--
a	{
		color: #006600;
		text-decoration: none;
	}
.mau{background:#FFCC99;}
image{border:none;}

a:hover { COLOR: #CC0000}

.style1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size: 30px;
}
.style2 {
	font-size: 18px;
	font-weight: bold;
	color: #FFFFFF;
  
}
.style3 {
	color: #FFFFFF;
	font-size:14px;
  
}
.style4 {color: #006600; font-weight: bold; font-size: 18px; }
.style5 {color:#0000000; font-weight: bold; font-size: 18px; }
.style6 {
	font-size: 22px;
	font-weight: bold;
	color: #000099;
}
.style7{
	font-size: 20px;
	font-weight: bold;
}
.mo	{	color:#0000FF;	}
.cham { border-bottom-color:#666666;
		border-bottom-style:dotted;
		border-bottom-width:thin;	}
.style8 {
	font-size: 20px;
	color: #000099;
	font-weight:bold;
}
-->
</style>
</head>

<body>
<?php 
        $cnk=$_SESSION['cnk']; 
        $sql=mysql_query("select * from khoa where username='$cnk'");
		$r=mysql_fetch_row($sql);
		$tenkhoa=$r[1];
		$makhoa=$r[0];
?>
<table width="900" height="600" border="0" bordercolorlight="#CCCCCC" align="center" cellpadding="0" cellspacing="0" style="border:1px solid #CCCCCC">

<!-- đầu trang --> 	
    <tr> <td width="900" height="70" background="image/header.gif">
    	
        <table width="100%" height="100%" border="0"> 
             <tr>
       		
				    <td width="10%" rowspan="2"><img src="image/logo.gif" width="100%" height="70" /></td>
					
					<td width="60%" rowspan="2" height="70" align="center" style="font-size:24px"><div align="center">
					  <blockquote>
						<p><span class="style1">Website ĐÁNH GIÁ HỌC PHẦN</span></p>
					  </blockquote>
				  </div></td>
        
            </tr> 
			
			<tr>
				<td width="32%" valign="bottom" colspan="2" align="left"> <table>
					  <tr><td valign="bottom" style="font-weight:bold">
					  <div align="center" class="style3">
						<a class="style3"  href="helpkhoa.htm" target="_blank">Hướng dẫn</a> | <a class="style3" href="cnk-trangchu.php">Trang chủ</a> | <a class="style3" href="logout.php">Thoát</a></div></td></tr>
					  <tr><td valign="bottom" style="font-weight:bold">
					  <div align="center" class="style3">Xin chào! Khoa <?php echo $tenkhoa; ?></div></td></tr> 
				       </table>
			    </td> 
			</tr>
			
	    </table>
    
    </td> </tr>
<!-- thân trang -->  	
    <tr height="450"> 
	      <td valign="top" bordercolor="#FFFFFF">
						   <table border="0" align="center">
							 <tr>
								 <td height="100">&nbsp;
										
								 </td>
							 </tr>
							 <tr>
								  <td>
											<form name="f" method="post" >
															  <table width="500"  border="0"  align="center" style="border:1px solid #0066FF" cellpadding="0" cellspacing="0">
															  
															  
																	<tr bordercolor="#FFFFFF"> 
																		  <td height="35" colspan="2" align="center" background="image/bg_header.gif">
															<span style="font-size:24px; color:#FFFFFF; font-weight:bold;">So Sánh Kết Quả Đánh Giá Học Phần </span>
																		 </td>
																	
																	</tr>
																	<tr><td colspan="2" height="20">&nbsp;</td></tr>
																	
																	<tr height="30"  bordercolor="#FFFFFF"  >  
																		  <td   align="center" style="font-size:18px" >
																	            Mã Học Phần:
																		  </td>
																		  <td>
																		       <select name="mahp" id="mahp" >
																			        <?php
																					    $str=mysql_query("select distinct(a.ma_hp) from `lop hoc phan` a,`giang vien` b, `bo mon` c where a.ma_gv=b.ma_gv and b.ma_bm=c.ma_bm and c.ma_khoa='$makhoa' ");
																						while($a=mysql_fetch_row($str))
																						{
																						     $mahp=$a[0];
																					?>
																					         <option><?php echo $mahp; ?></option>
																					<?php
																						}//ngoac while
																
																					?>
																			   </select>
																		  </td>
																			
																	</tr>
																	<tr height="30"  bordercolor="#FFFFFF" >  
																		  <td  style="font-size:18px; " align="center" width="200">
																				Học Kì:
																		  </td>
																		  <td  align="left" width="200">
																				<select name="hk" id="hk" >
																						   
																				 <?php 
																						$sql=mysql_query("select distinct (hocki) from `hocki nienkhoa` where hocki != (select hocki from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)) "); 
																						 while($r=mysql_fetch_row($sql))
																						 {
																							
																							$hk=$r[0];
																							
																				 ?>
																							<option ><?php echo  $hk; ?> </option>
																				<?php 
																						 }//ngoac while
																				?>
																				<?php         $sql1=mysql_query("select * from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)");
																							  $r1=mysql_fetch_row($sql1);
																							  $hk=$r1[1];
																				?>
																						 <option  selected="selected"><?php  echo $hk;?> </option>
																						   
																				</select>
																		  </td>
																		  
																	</tr>
																	<tr height="30"  bordercolor="#FFFFFF" >  
																		  <td  style="font-size:18px;" align="center" width="200" >
																				Niên Khóa:
																		  </td>
																		  <td align="left" >
																				<select name="nk" id="nk">
																						  <?php
																						$sql=mysql_query("select distinct(nienkhoa)  from `hocki nienkhoa` where nienkhoa != (select nienkhoa  from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)) "); 
																						 while($r=mysql_fetch_row($sql))
																						 {
																							
																							$nk=$r[0];
																				 ?>
																							<option ><?php echo  $nk; ?> </option>
																				<?php 
																						 }//ngoac while
																				?>
																				<?php         $sql1=mysql_query("select *  from `hocki nienkhoa` where ma_hknk=(select max(ma_hknk) from `hocki nienkhoa`)");
																							  $r1=mysql_fetch_row($sql1);
																							  $nk=$r1[2];
																				?>
																						 <option  selected="selected"><?php  echo $nk;?> </option> 
																				</select>
																		  </td>
																		  
																	</tr>
																	
																	
																	
																	<tr height="30"  bordercolor="#FFFFFF" >  
																		  <td   align="center" colspan="2">
																				<input type="submit" name="xem" value="Xem Kết Quả" />
																		  </td>
																			
																	</tr>				
																	<tr height="10"  bordercolor="#FFFFFF" >  
																		  <td   align="center" colspan="2">
																	
																		  </td>
																			
																	</tr>	
																   
															</table>
											</form>
										</td>
									</tr>
						</table>
         </td>
	 </tr>
	 <tr><td height="20">&nbsp;</td></tr>

<!-- cuối trang -->  
	<tr> 
	      <td height="28" background="image/footer.gif" class="style3" align="center" >
	     </td>
    </tr>
<!-- het cuoi trang-->


</table>

</body>
</html>
<?php
       if(isset($_POST["xem"]))
	   {
	           
								$hocki=$_POST["hk"]; 
								$nienkhoa=$_POST["nk"];
								$mahp=$_POST["mahp"]; 
								$nienk="$nienkhoa";
								$str=mysql_query("select * from `hocki nienkhoa` where hocki='$hocki' and nienkhoa = '$nienk' ");
							    $t=mysql_fetch_array($str);
								$hknk=$t[0];
								$sql=mysql_query("select * from `lop hoc phan` where ma_hp='$mahp' and ma_hknk='$hknk'");
								$count=mysql_num_rows($sql);
								if($count >0)
								       echo "<meta http-equiv='refresh' content='0; URL=cnk-sskqhp.php?ma=$hknk&mahp=$mahp ' />";
							    else
								{
								       echo "<script language='javascript'>alert('Hoc Phan khong duoc Giang Day trong Hoc ki nay')</script>";
									   echo "<meta http-equiv='refresh' content='0; URL=cnk-sshp.php ' />";
								}
								
							
	   }//ngoac if
?>




